<div id="ad<?php echo $module; ?>" class="ad">
  <?php foreach ($ads as $ad) { ?>
  <?php if ($ad['link']) { ?>
  <div><a href="<?php echo $ad['link']; ?>"><img src="<?php echo $ad['image']; ?>" alt="<?php echo $ad['title']; ?>" title="<?php echo $ad['title']; ?>" /></a></div>
  <?php } else { ?>
  <div><img src="<?php echo $ad['image']; ?>" alt="<?php echo $ad['title']; ?>" title="<?php echo $ad['title']; ?>" /></div>
  <?php } ?>
  <?php } ?>
</div>
<script type="text/javascript"><!--
$(document).ready(function() {
	$('#ad<?php echo $module; ?> div:first-child').css('display', 'block');
});

var ad = function() {
	$('#ad<?php echo $module; ?>').cycle({
		before: function(current, next) {
			$(next).parent().height($(next).outerHeight());
		}
	});
}

setTimeout(ad, 2000);
//--></script>